<?php

class Core_Model_Layout extends Nuo_Db_Table_Row
{

	/**
	 * object type
	 * @property string
	 */
	protected $_kind = 'core@layout';

	/**
	 * get identitys
	 * @return int
	 */
	public function getId()
	{
		return $this -> layout_id;
	}

	/**
	 * get priority
	 * @return int
	 */
	public function getPriority()
	{
		return $this -> ele_priority;
	}

	/**
	 * get element title
	 * @return string
	 */
	public function getTitle()
	{
		return $this -> title;
	}

	/**
	 * get section name
	 * @return string [header, footer, content]
	 */
	public function getRegion()
	{
		return $this -> layout_region;
	}

	/**
	 * get module name
	 * @return string
	 */
	public function getModule()
	{
		return $this -> module;
	}

	/**
	 * check is default ?
	 * @return bool
	 */
	public function isDefault()
	{
		return $this -> is_default;
	}

	/**
	 * get mode
	 * @return string [front-end,admin]
	 */
	public function getSide()
	{
		return $this -> layout_side;
	}

	/**
	 * get page name
	 * @return string
	 */
	public function getPageName()
	{
		return $this -> action_id;
	}

	public function getActionId()
	{
		return $this -> action_id;
	}

	/**
	 * @return array
	 */
	public function getElements()
	{

		$table = Nuo::getTable('core@layoutblock');

		$select = $table -> select() -> where('layout_id=?', $this -> layout_id) -> where('block_enabled=1') -> order('block_priority ASC');

		$rows = $table -> fetchAll($select);

		foreach ($rows as $row)
		{

		}

		return $rows -> toArray();
	}

}
